<style scoped lang="less">

	.q-goods-item-price {
		color: #DD4738;
	}
	
	.q-goods-item {
		margin-top: 0.4rem;
		width: 4.7rem;
	}
	
	.q-goods-item-wrap {
		
		background-color: white;
		padding: 0 0.2rem 0.2rem 0.2rem;
		display: flex;
		flex-wrap: wrap;
		justify-content: space-between;
	}
	.q-goods-item-img{
		height: 4.7rem;
		width: 100%;
	}
	
	.q-goods-item-title {
		line-height: 1.4;
		font-size: 0.5rem;
		height: 1.3rem;
		text-overflow: -o-ellipsis-lastline;
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-line-clamp: 2;
		line-clamp: 2;
		-webkit-box-orient: vertical;
	}
	.q-goods-item-discount {
		height: 0.6rem;
		color: @--price;
		font-size: 0.4rem;
	}
	.q-goods-item-info {
		font-size: 0.4rem;
		margin-top: 0.2rem;
		display: flex;
		justify-content: space-between;
	}
	span.q-goods-item-sales {
		color: @--gray;
	}
</style>
<template>
	<div class="q-goods-item-wrap">
		<div @click="jump(item.goods_id)" class="q-goods-item" v-for="(item,index) in list" :key="index">
			<van-image class="q-goods-item-img" :src="GLOBAL.getUrl(item.banner!=null?item.banner[0]:'')" lazy-load></van-image>
			<div class="q-goods-item-title">{{item.title}}</div>
			<div class="q-goods-item-discount">
				{{(item.vip_discount===null||item.vip_discount===0)?' ':'会员优惠:'+item.vip_discount/100+'元'}}
			</div>
			<div class="q-goods-item-info">
										<span class="q-goods-item-price"><span
											class="q-goods-item-symbol">￥</span>{{item.price/100}}</span>
				<span class="q-goods-item-sales">{{item.sales>0?'已售'+item.sales:''}}</span>
			</div>
		</div>
	</div>
</template>
<script>
  import Vue from 'vue';
  import {Image} from 'vant';
  import {actionDis} from "../../libs/action-tools";

  Vue.use(Image);
  export default {
    name: 'goods-items',
    props: {
      list: {
        type: Array, default: function () {
          return [];
        }
      }
    },
    data() {
      return {};
    },
    methods: {
      jump(goods_id) {
        actionDis({type: this.GLOBAL.TYPE_LINK_ACTIVE, value: goods_id}, this)
      },
    }
  }
</script>